<%= render 'spree/admin/shared/error_messages', target: address %>
<%= render 'spree/addresses/form',
                  address_name: 'address',
                  address_form: f,
                  address_type: 'shipping',
                  address: address %>
<% if @order.user.present? && @order.user.addresses.many? %>
  <div>
    <div class="w-100 text-center mb-2"><%= Spree.t(:or_select_other_address) %></div>
    <%= label_tag :shipping_address_id, Spree.t(:existing_address), class: 'sr-only' %>
    <%= select_tag :shipping_address_id, 
                   options_for_select(@order.user.addresses.map { |a| [a.to_s.gsub('<br/>', ", "), a.id]}), 
                   { include_blank: Spree.t(:select_existing_address), class: "custom-select", data: { action: 'auto-submit#submit' } } %>
  </div>
<% end %>
